package com.Smart.smartscals.Utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

/**
 *  SharePreferencnce工具类
 * @author huangbin
 *
 */
public final class SharePreferceTools {

	private SharedPreferences preferences;
	private Editor editor;
	
	/**
	 * 初始化
	 * @param context
	 * @param sharePreName  文件名
	 */
	public SharePreferceTools(Context context,String sharePreName) {
		super();
	this.preferences =	context.getSharedPreferences(sharePreName, Context.MODE_WORLD_WRITEABLE);
	this.editor = preferences.edit();
	}
	
	
	
	public void  setInt(String intStringTag,int tmp){
		editor.putInt(intStringTag, tmp);
		editor.commit();
	}
	public void  setString(String intStringTag,String tmp){
		editor.putString(intStringTag, tmp);
		editor.commit();
	}
	public void  setBoolean(String intStringTag,Boolean tmp){
		editor.putBoolean(intStringTag, tmp);
		editor.commit();
	}
	
	
	
	
	public int  getInt(String intStringTag){
	
		return preferences.getInt(intStringTag, 0);
	}
	

	public String  getString(String intStringTag){
	
		return preferences.getString(intStringTag, "");
	}
	public Boolean  getBoolean(String intStringTag){
		
		return preferences.getBoolean(intStringTag, false);
	}
	
	
	
	
	
	
	
	

}
